
const Router = require('./router/index')

const path = require('path')
const koaStatic = require('koa-static')
const { koaBody } = require('koa-body');
const bodyParser = require('koa-bodyparser');
const koa2 = require('koa')

const { verify } = require('./jwt/token')

const { APP_PORT } = require('./config/config.default')

const app = new koa2()

app
.use(koaBody({
    multipart: true,
    formidable: {
        uploadDir: path.join(__dirname, './image'),
        keepExtensions: true
    }
}))
.use(bodyParser())
.use(koaStatic(path.join(__dirname, './image')))
.use(verify)
.use(Router.routes())
.use(Router.allowedMethods())
app.listen(APP_PORT)  